/**
 * @file rank/popularize/luogu1449/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/8 12:05:25
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 1010;
char s[N];
int main() {
  // High rating and good luck!
  cin >> s;
  int n = strlen(s);
  int val = 0;
  stack<int> stk;
  for (int i = 0; i < n; ++i) {
    int ch = s[i];
    if (isdigit(ch)) {
      val *= 10;
      val += (ch - '0');
    } else if (ch == '.') {
      stk.push(val);
      val = 0;
    } else if (ch == '@') {
      break;
    } else {
      int b = stk.top();
      stk.pop();
      int a = stk.top();
      stk.pop();
      if (ch == '+') {
        stk.push(a + b);
      } else if (ch == '-') {
        stk.push(a - b);
      } else if (ch == '*') {
        stk.push(a * b);
      } else if (ch == '/') {
        stk.push(a / b);
      } else {
        assert(false);
      }
    }
  }
  cout << stk.top() << endl;
  return 0;
}
